FROM apache/cassandra-centos7-build

#作者
MAINTAINER ff<2248789023@qq.com>

#设置标签
LABEL FF_PHP=1.0

RUN yum -y install wget sqlite-devel  curl

WORKDIR /usr/local

RUN curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo && \
yum clean all

RUN yum remove oniguruma-devel -y
RUN yum remove oniguruma -y

RUN rpm -ivh https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-6.8.2-1.el7.x86_64.rpm
RUN rpm -ivh https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-devel-6.8.2-1.el7.x86_64.rpm

#安装依赖
RUN yum install -y cmake pcre pcre-devel openssl  gd-devel \
zlib-devel gcc gcc-c++ net-tools iproute telnet  curl \
 vim libxml2 libxml2-devel  openssl-devel libjpeg-turbo \
libjpeg-turbo-devel libpng-devel libpng freetype-devel freetype icu \
libicu-devel libicu libmcrypt libmcrypt-devel libxslt libxslt-devel  php-mysql

RUN useradd www -u 1200 -M -s /sbin/nologin
RUN wget https://www.php.net/distributions/php-7.4.23.tar.gz
RUN tar xf php-7.4.23.tar.gz
WORKDIR php-7.4.23
RUN ./configure --prefix=/usr/local/php-7.4.23 \
--with-config-file-path=/usr/local/php-7.4.23/etc \
--with-config-file-scan-dir=/usr/local/php-7.4.23/conf.d \
--enable-fpm --with-fpm-user=www \
--with-fpm-group=www \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-iconv-dir \
--with-zlib \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--enable-mbregex \
--enable-mbstring \
--enable-ftp \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-soap \
--with-gettext \
--disable-fileinfo \
--enable-opcache \
--enable-intl \
--with-xsl
RUN make -j 4 && make install
RUN cp ./sapi/fpm/php-fpm.conf /usr/local/php-7.4.23/etc/php-fpm.conf && \
cp /usr/local/php-7.4.23/php.ini-production /usr/local/php-7.4.23/etc/php.ini && \
cp /usr/local/php-7.4.23/etc/php-fpm.d/www.conf.default /usr/local/php-7.4.23/etc/php-fpm.d/www.conf && \
sed  -i  "s#127.0.0.1:9000#0.0.0.0:9000#g" /usr/local/php-7.4.23/etc/php-fpm.d/www.conf && \
sed -in '99idaemonize = yes' /usr/local/php-7.4.23/etc/php-fpm.conf && \
cp /usr/local/php-7.4.23/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm && \
chmod a+x /etc/init.d/php-fpm
WORKDIR /
RUN rm -rf /php-7.4.23.tar.gz
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
CMD /usr/local/php-7.4.23/sbin/php-fpm -F
EXPOSE 9000